package action.expert;

import java.util.List;

import persistence.model.TdfkfaDictCity;
import persistence.model.TdfkfaDictExperttype;
import persistence.model.TdfkfaDictProvince;
import persistence.model.TdfkfaDictQualification;
import persistence.model.TdfkfaDictTitle;
import service.DictInfoService;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class AddExpertPrepareAction extends ActionSupport {

    private static final long serialVersionUID = 1L;

    private DictInfoService dictInfoService;

    private List<TdfkfaDictProvince> provinceList;

    private List<TdfkfaDictCity> cityList;

    private List<TdfkfaDictQualification> qualificationList;

    private List<TdfkfaDictTitle> titleList;
    
    private List<TdfkfaDictExperttype> typeList;

    private String provinceId;

    public String initPrepare() throws Exception {

        provinceList = dictInfoService.getProvinceList();
        qualificationList = dictInfoService.getQualificationList();
        titleList = dictInfoService.getTitleList();
        typeList = dictInfoService.getExpertTypeList();

        return Action.SUCCESS;
    }
    
    public String initExpertType() throws Exception {
        typeList = dictInfoService.getExpertTypeList();
        return SUCCESS;
    }

    public String loadSelectCityList() throws Exception {

        if (provinceId != null && !"".equals(provinceId)) {
            cityList = dictInfoService.getCityList(new Integer(provinceId));
        }
        return Action.SUCCESS;
    }

    public void setDictInfoService(DictInfoService dictInfoService) {
        this.dictInfoService = dictInfoService;
    }

    public List<TdfkfaDictProvince> getProvinceList() {
        return provinceList;
    }

    public void setProvinceList(List<TdfkfaDictProvince> provinceList) {
        this.provinceList = provinceList;
    }

    public List<TdfkfaDictCity> getCityList() {
        return cityList;
    }

    public List<TdfkfaDictQualification> getQualificationList() {
        return qualificationList;
    }

    public List<TdfkfaDictTitle> getTitleList() {
        return titleList;
    }

    public List<TdfkfaDictExperttype> getTypeList() {
        return typeList;
    }

    public void setProvinceId(String provinceId) {
        this.provinceId = provinceId;
    }

}
